//
//  HWEditAddressViewController.m
//  HWanGame
//
//  Created by 开源纵横 on 2019/11/6.
//  Copyright © 2019 Chendaobin. All rights reserved.
//




#import "HWEditAddressViewController.h"

#import "HWShouHuoDiZhiCell.h"
#import "HWMorendizhiTableViewCell.h"
#import "HWLocallyStoredData.h"
#import<CommonCrypto/CommonDigest.h>
#import "HWAES128.h"
#import "WMUtil.h"
@interface HWEditAddressViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic)UIView *lowerPartView;
@property(strong,nonatomic) NSMutableArray  *dataArr;
@property(strong,nonatomic) NSMutableArray *plaseMutabel;
@property(strong,nonatomic) NSMutableArray *contentMutabelArr;
@property(strong,nonatomic) UITextField *nameTextfield1;
@property(strong,nonatomic) UITextField *nameTextfield2;
@property(strong,nonatomic) UITextField *nameTextfield3;

@property(strong,nonatomic) UITextField *nameTextfield4;  // 支付宝姓名

@property(strong,nonatomic) UITextField *nameTextfield5; // 支付宝账号




@property(assign,nonatomic) BOOL  xuanzhongBoor;


@end

@implementation HWEditAddressViewController

-(UITableView *)mainaTableVie {
    
    if  (_mainaTableVie == nil) {
        
        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH-44-CF_TabbarSafeBottomMargin) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = RGB(241, 242, 244);
        
    }
    return   _mainaTableVie ;
    
}






- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self addCommonAttributes];
    
    [self setupUI];
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
    //设置成NO表示当前控件响应后会传播到其他控件上，默认为YES。
    tapGestureRecognizer.cancelsTouchesInView = NO;
    [self.view addGestureRecognizer:tapGestureRecognizer];
}

-(void)keyboardHide:(UITapGestureRecognizer*)tap{
    
    [self.nameTextfield1 resignFirstResponder];
    [self.nameTextfield2 resignFirstResponder];
    [self.nameTextfield3 resignFirstResponder];
    
    
}

// 添加常用的属性
- (void)addCommonAttributes {
    
    
    self.xuanzhongBoor = NO;
    self.dataArr = [[NSMutableArray alloc]init];
    [self.dataArr addObject:@"收货人"];
    [self.dataArr addObject:@"手机号"];
    [self.dataArr addObject:@"支付宝姓名"];
       [self.dataArr addObject:@"支付宝账号"];
    
    [self.dataArr addObject:@"详细信息"];

    self.plaseMutabel = [[NSMutableArray alloc]init];
    [self.plaseMutabel addObject:self.name];
    [self.plaseMutabel addObject:self.mobile];
    [self.plaseMutabel addObject:self.xingming];
    [self.plaseMutabel addObject:self.zhanghaostr];
    [self.plaseMutabel addObject:self.uaddress];
    self.contentMutabelArr = [[NSMutableArray alloc]init];
    [self.contentMutabelArr  addObject:@""];
    [self.contentMutabelArr  addObject:@""];
    [self.contentMutabelArr  addObject:@""];

    
    
    
    
 
    
    
    
    
    
    
    
}




- (void)setupUI {
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"我的收货地址";
    [self.view addSubview:self.mainaTableVie];
    [self addLowerPartView];
    
    //    UIPasteboard *pb = [UIPasteboard generalPasteboard];
    //    pb.string = @"1111";
    //
    
}





// 添加低部UIview
- (void)addLowerPartView {
    
    self.lowerPartView = [[UIView alloc]initWithFrame:CGRectMake(0, kScreenH-44-CF_TabbarSafeBottomMargin, kScreenW, 44+CF_TabbarSafeBottomMargin)];
    // self.lowerPartView.backgroundColor = [UIColor yellowColor];
    self.lowerPartView.backgroundColor = RGB(241, 242, 244);
    [self.view addSubview:self.lowerPartView];
    
    UIButton *butt  = [UIButton setButtonWithFrame:CGRectMake(15, 4, kScreenW-30, 36) Title:@"修改" Image:nil Font:14 Color:RGB(255, 255, 255) Target:self Selector:@selector(buttonTap)];
    butt.backgroundColor = blueBackgroundBT;
    butt.layer.cornerRadius = 18;
    butt.layer.masksToBounds = YES;
      butt.backgroundColor = [UIColor bm_colorGradientChangeWithSizeView:butt];
    [self.lowerPartView addSubview:butt];
    
    
    
    
    
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return  2;
    
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (section == 0) {
        return  5;
    }
    return  1;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    if (indexPath.section == 0) {
        
        
        static NSString *cellID  = @"cellID";
        HWShouHuoDiZhiCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        if (!cell) {
            cell = [[HWShouHuoDiZhiCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        }

        //  cell.textLabel.text = @"12345";
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        cell.nameLabel.text = self.dataArr[indexPath.row];
        
        
        
        NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:self.plaseMutabel[indexPath.row] attributes:
                                                 @{NSForegroundColorAttributeName:RGB(153, 153, 153),
                                                   NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}
                                                 ];
        cell.nametextField.attributedPlaceholder  = attrString;
        cell.nametextField.text = self.self.plaseMutabel[indexPath.row];

        if (indexPath.row == 0) {
            self.nameTextfield1 = cell.nametextField;
            
        } else if (indexPath.row == 1) {
            self.nameTextfield2 = cell.nametextField;
            
        }else if (indexPath.row == 2) {
            
            self.nameTextfield4 =  cell.nametextField;
            
        } else if (indexPath.row == 3) {
            
             self.nameTextfield5 =  cell.nametextField;
            
        }else {
            self.nameTextfield3 = cell.nametextField;
            
        }
        
        
        //        [self.contentMutabelArr addObject:self.nameTextfield.text];
        
        return  cell;
        
    } else {
        
        
        static NSString *cellID  = @"cellID";
        
        HWMorendizhiTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        if (!cell) {
            cell = [[NSBundle mainBundle]loadNibNamed:@"HWMorendizhiTableViewCell" owner:nil options:nil].lastObject;
            
        }
        
        cell.backgroundColor = [UIColor whiteColor];
        
        [cell.xuanzhongSwitvch setOn: self.xuanzhongBoor];
        
        
        
        return cell;
        
    }
    
    
    
    
}


- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section {
    
    return  10;
    
    //    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 6)];
    //    backview.backgroundColor = RGB(241, 242, 244);
    //
    //    return backview;
    
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    
    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 10)];
    backview.backgroundColor = RGB(241, 242, 244);
    
    return backview;
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    return  40;
    
}


#pragma mark ------------- 点击保存按钮

- (void)buttonTap {
    
    DLog(@"保存按钮");
    [self configRequest];
    
    
}

- (void)configRequest {
    [SVProgressHUD show];
    
    
    
    __weak typeof(self) weakSelf = self;
    
    NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间
    NSTimeInterval time=[date timeIntervalSince1970];
    NSString *timeSp = [NSString stringWithFormat:@"%.0f", time];
    
    NSString *moren = [NSString stringWithFormat:@"%d", self.xuanzhongBoor];
    
    NSString *sign = @"fsd213ewdsadqwe2121213edsad";
    NSString *one = self.nameTextfield1.text ? self.nameTextfield1.text : self.name;
    NSString *two = self.nameTextfield2.text ? self.nameTextfield2.text : self.mobile;
    NSString *thr = self.nameTextfield3.text ? self.nameTextfield3.text : self.uaddress;
    
   NSString *fou  = self.nameTextfield4.text ? self.nameTextfield4.text : self.xingming;
    NSString *setck  = self.nameTextfield5.text ? self.nameTextfield5.text : self.zhanghaostr;
    
    BOOL isMobile = [WMUtil validateMobile:two];
    NSLog(@"+++%@", two);
    if (isMobile == NO) {
        [SVProgressHUD showErrorWithStatus:@"请输入正确的手机号"];

    } else {
        NSDictionary *signDic = @{
                                  @"consignee" : one,
                                  @"mobile" : two,
                                  @"uaddress" : thr,
                                  @"moren" : moren,
                                  @"bank_user" :fou,
                                  @"bank_id" :setck,
                                  };
        NSString *jsonStr = [self convertToJsonData:signDic];
        NSString *encryStr = [HWAES128 AES128Encrypt:jsonStr key:@"mtetbpryjhdxmnhx"];
        NSLog(@"!!!json:%@", jsonStr);
        
        NSLog(@"!!!%@", encryStr);
        
        
        NSDictionary *parameters = @{
                                     @"ct" : @"app",
                                     @"ac" : @"address_edit",
                                     @"uid" : [HWLocallyStoredData getLoginUserID],
                                     @"t" : timeSp,
                                     @"sign" : [WMUtil md5HexDigest:[NSString stringWithFormat:@"%@%@%@", [HWLocallyStoredData getLoginUserID], timeSp, sign]],
                                     @"id" : self.Id,
                                     @"value" : encryStr,
                                     };
        
        [HWWebUtils doGetWithParameters:parameters progress:nil success:^(id response) {
            
            [SVProgressHUD dismiss];
            if ([response[@"code"] integerValue] == 1) {
                
                
                [MBProgressHUD showSuccess:response[@"message"]];
                [weakSelf.navigationController popViewControllerAnimated:YES];
                
                
            } else {
                
                [MBProgressHUD showError:response[@"message"]];
                
            }
            
            
        } failure:^(NSString *error) {
            [SVProgressHUD dismiss];
        }];
    }
    
    
}


-(NSString *)convertToJsonData:(NSDictionary *)dict {
    
    NSError *error;
    
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
    
    NSString *jsonString;
    
    if (!jsonData) {
        NSLog(@"%@",error);
    }else{
        jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
    }
    NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
    NSRange range = {0,jsonString.length};
    
    //去掉字符串中的空格
    [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
    NSRange range2 = {0,mutStr.length};
    
    //去掉字符串中的换行符
    [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
    
    return mutStr;
    
}




@end



#pragma mark --------  以前的代码


//#import "HWEditAddressViewController.h"
//
//#import "HWShouHuoDiZhiCell.h"
//#import "HWMorendizhiTableViewCell.h"
//#import "HWLocallyStoredData.h"
//#import<CommonCrypto/CommonDigest.h>
//#import "HWAES128.h"
//#import "WMUtil.h"
//@interface HWEditAddressViewController ()<UITableViewDataSource,UITableViewDelegate>
//@property(strong,nonatomic) UITableView *mainaTableVie;
//@property(strong,nonatomic)UIView *lowerPartView;
//@property(strong,nonatomic) NSMutableArray  *dataArr;
//@property(strong,nonatomic) NSMutableArray *plaseMutabel;
//@property(strong,nonatomic) NSMutableArray *contentMutabelArr;
//@property(strong,nonatomic) UITextField *nameTextfield1;
//@property(strong,nonatomic) UITextField *nameTextfield2;
//@property(strong,nonatomic) UITextField *nameTextfield3;
//@property(assign,nonatomic) BOOL  xuanzhongBoor;
//@end
//
//@implementation HWEditAddressViewController
//
//-(UITableView *)mainaTableVie {
//
//    if  (_mainaTableVie == nil) {
//
//        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH-44-CF_TabbarSafeBottomMargin) style:UITableViewStylePlain];
//        _mainaTableVie.delegate = self;
//        _mainaTableVie.dataSource = self;
//        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
//
//        _mainaTableVie.backgroundColor = [UIColor whiteColor];
//        _mainaTableVie.backgroundColor = RGB(241, 242, 244);
//
//    }
//    return   _mainaTableVie ;
//
//}
//
//
//
//
//
//
//- (void)viewDidLoad {
//    [super viewDidLoad];
//    // Do any additional setup after loading the view.
//
//    [self addCommonAttributes];
//
//    [self setupUI];
//    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
//    //设置成NO表示当前控件响应后会传播到其他控件上，默认为YES。
//    tapGestureRecognizer.cancelsTouchesInView = NO;
//    [self.view addGestureRecognizer:tapGestureRecognizer];
//}
//
//-(void)keyboardHide:(UITapGestureRecognizer*)tap{
//
//    [self.nameTextfield1 resignFirstResponder];
//    [self.nameTextfield2 resignFirstResponder];
//    [self.nameTextfield3 resignFirstResponder];
//
//
//}
//
//// 添加常用的属性
//- (void)addCommonAttributes {
//
//
//    self.xuanzhongBoor = NO;
//    self.dataArr = [[NSMutableArray alloc]init];
//    [self.dataArr addObject:@"收货人"];
//    [self.dataArr addObject:@"手机号"];
//    [self.dataArr addObject:@"详细信息"];
//
//    self.plaseMutabel = [[NSMutableArray alloc]init];
//    [self.plaseMutabel addObject:self.name];
//    [self.plaseMutabel addObject:self.mobile];
//    [self.plaseMutabel addObject:self.uaddress];
//    self.contentMutabelArr = [[NSMutableArray alloc]init];
//    [self.contentMutabelArr  addObject:@""];
//    [self.contentMutabelArr  addObject:@""];
//    [self.contentMutabelArr  addObject:@""];
//
//
//
//}
//
//
//
//
//- (void)setupUI {
//
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationItem.title = @"我的收货地址";
//    [self.view addSubview:self.mainaTableVie];
//    [self addLowerPartView];
//
//    //    UIPasteboard *pb = [UIPasteboard generalPasteboard];
//    //    pb.string = @"1111";
//    //
//
//}
//
//
//
//
//
//// 添加低部UIview
//- (void)addLowerPartView {
//
//    self.lowerPartView = [[UIView alloc]initWithFrame:CGRectMake(0, kScreenH-44-CF_TabbarSafeBottomMargin, kScreenW, 44+CF_TabbarSafeBottomMargin)];
//    // self.lowerPartView.backgroundColor = [UIColor yellowColor];
//    self.lowerPartView.backgroundColor = RGB(241, 242, 244);
//    [self.view addSubview:self.lowerPartView];
//
//    UIButton *butt  = [UIButton setButtonWithFrame:CGRectMake(15, 4, kScreenW-30, 36) Title:@"修改" Image:nil Font:14 Color:RGB(255, 255, 255) Target:self Selector:@selector(buttonTap)];
//    butt.backgroundColor = blueBackgroundBT;
//    butt.layer.cornerRadius = 18;
//    butt.layer.masksToBounds = YES;
//    [self.lowerPartView addSubview:butt];
//
//
//
//
//
//}
//
//
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//
//    return  2;
//
//
//
//}
//
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//
//    if (section == 0) {
//        return  3;
//    }
//    return  1;
//}
//
//
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//
//
//    if (indexPath.section == 0) {
//
//
//        static NSString *cellID  = @"cellID";
//        HWShouHuoDiZhiCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//        if (!cell) {
//            cell = [[HWShouHuoDiZhiCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
//        }
//
//        //  cell.textLabel.text = @"12345";
//
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor whiteColor];
//        cell.nameLabel.text = self.dataArr[indexPath.row];
//
//
//
//        NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:self.plaseMutabel[indexPath.row] attributes:
//                                                 @{NSForegroundColorAttributeName:RGB(153, 153, 153),
//                                                   NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}
//                                                 ];
//        cell.nametextField.attributedPlaceholder  = attrString;
//        cell.nametextField.text = self.self.plaseMutabel[indexPath.row];
//
//        if (indexPath.row == 0) {
//            self.nameTextfield1 = cell.nametextField;
//
//        } else if (indexPath.row == 1) {
//            self.nameTextfield2 = cell.nametextField;
//
//        } else {
//            self.nameTextfield3 = cell.nametextField;
//
//        }
//
//
//        //        [self.contentMutabelArr addObject:self.nameTextfield.text];
//
//        return  cell;
//
//    } else {
//
//
//        static NSString *cellID  = @"cellID";
//
//        HWMorendizhiTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//        if (!cell) {
//            cell = [[NSBundle mainBundle]loadNibNamed:@"HWMorendizhiTableViewCell" owner:nil options:nil].lastObject;
//
//        }
//
//        cell.backgroundColor = [UIColor whiteColor];
//
//        [cell.xuanzhongSwitvch setOn: self.xuanzhongBoor];
//
//
//
//        return cell;
//
//    }
//
//
//
//
//}
//
//
//- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section {
//
//    return  10;
//
//    //    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 6)];
//    //    backview.backgroundColor = RGB(241, 242, 244);
//    //
//    //    return backview;
//
//}
//
//
//- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
//
//    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 10)];
//    backview.backgroundColor = RGB(241, 242, 244);
//
//    return backview;
//
//
//}
//
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//
//
//
//    return  40;
//
//}
//
//
//#pragma mark ------------- 点击保存按钮
//
//- (void)buttonTap {
//
//    DLog(@"保存按钮");
//    [self configRequest];
//
//
//}
//
//- (void)configRequest {
//    [SVProgressHUD show];
//
//
//
//    __weak typeof(self) weakSelf = self;
//
//    NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间
//    NSTimeInterval time=[date timeIntervalSince1970];
//    NSString *timeSp = [NSString stringWithFormat:@"%.0f", time];
//
//    NSString *moren = [NSString stringWithFormat:@"%d", self.xuanzhongBoor];
//
//    NSString *sign = @"fsd213ewdsadqwe2121213edsad";
//    NSString *one = self.nameTextfield1.text ? self.nameTextfield1.text : self.name;
//    NSString *two = self.nameTextfield2.text ? self.nameTextfield2.text : self.mobile;
//    NSString *thr = self.nameTextfield3.text ? self.nameTextfield3.text : self.uaddress;
//    BOOL isMobile = [WMUtil validateMobile:two];
//    NSLog(@"+++%@", two);
//    if (isMobile == NO) {
//        [SVProgressHUD showErrorWithStatus:@"请输入正确的手机号"];
//
//    } else {
//        NSDictionary *signDic = @{
//                                  @"consignee" : one,
//                                  @"mobile" : two,
//                                  @"uaddress" : thr,
//                                  @"moren" : moren,
//                                  };
//        NSString *jsonStr = [self convertToJsonData:signDic];
//        NSString *encryStr = [HWAES128 AES128Encrypt:jsonStr key:@"mtetbpryjhdxmnhx"];
//        NSLog(@"!!!json:%@", jsonStr);
//
//        NSLog(@"!!!%@", encryStr);
//
//
//        NSDictionary *parameters = @{
//                                     @"ct" : @"app",
//                                     @"ac" : @"address_edit",
//                                     @"uid" : [HWLocallyStoredData getLoginUserID],
//                                     @"t" : timeSp,
//                                     @"sign" : [WMUtil md5HexDigest:[NSString stringWithFormat:@"%@%@%@", [HWLocallyStoredData getLoginUserID], timeSp, sign]],
//                                     @"id" : self.Id,
//                                     @"value" : encryStr,
//                                     };
//
//        [HWWebUtils doGetWithParameters:parameters progress:nil success:^(id response) {
//
//            [SVProgressHUD dismiss];
//            if ([response[@"code"] integerValue] == 1) {
//
//
//                [MBProgressHUD showSuccess:response[@"message"]];
//                [weakSelf.navigationController popViewControllerAnimated:YES];
//
//
//            } else {
//
//                [MBProgressHUD showError:response[@"message"]];
//
//            }
//
//
//        } failure:^(NSString *error) {
//            [SVProgressHUD dismiss];
//        }];
//    }
//
//
//}
//
//
//-(NSString *)convertToJsonData:(NSDictionary *)dict {
//
//    NSError *error;
//
//    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
//
//    NSString *jsonString;
//
//    if (!jsonData) {
//        NSLog(@"%@",error);
//    }else{
//        jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
//    }
//    NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
//    NSRange range = {0,jsonString.length};
//
//    //去掉字符串中的空格
//    [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
//    NSRange range2 = {0,mutStr.length};
//
//    //去掉字符串中的换行符
//    [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
//
//    return mutStr;
//
//}
//
//
//
//
//@end
//
